# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import cv2
import time
def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')
    cap = cv2.VideoCapture("rtsp://admin:ADMIN123@10.100.158.48")
    ret, frame = cap.read()
    while ret:
        processing_start = time.time()
        ret, frame = cap.read()
        # gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        cv2.imshow("frame", frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
        processing_end = time.time()
        processing_time_frame = processing_end - processing_start
        print("FPS: {}".format(1.0 / processing_time_frame))  # 注释 1

    cv2.destroyAllWindows()
    cap.release()

